#ifndef _TWOGRE_INTEGER_VARIABLE_H_
#define _TWOGRE_INTEGER_VARIABLE_H_

#include "TwOgrePrerequisites.h"
#include "TwOgreVariable.h"

#include "OgreString.h"

namespace TwOgre{
	
    class IntegerParams
    {
    public:
        IntegerParams(const Ogre::String& name)
            : parent_(0)
            , name_(name)
            , label_(Ogre::StringUtil::BLANK)
            , group_(Ogre::StringUtil::BLANK)
            , help_(Ogre::StringUtil::BLANK)
            , shortcutIncr_(Ogre::StringUtil::BLANK)
            , shortcutDecr_(Ogre::StringUtil::BLANK)
            , type_(TW_TYPE_INT32)
            , readOnly_(false)
            , data_(NULL)
            , setCB_(NULL)
            , getCB_(NULL)
            , min_(0)
            , max_(INT_INFINITY)
            , step_(1)
            , value_(0)
        {}
     
        IntegerParams& label(const Ogre::String& varLabel)
        {
            label_ = varLabel;
            return *this;
        }
        IntegerParams& group(const Ogre::String& varGroup)
        {
            group_ = varGroup;
            return *this;
        }
        IntegerParams& help(const Ogre::String& varHelp)
        {
            help_ = varHelp;
            return *this;
        }
        IntegerParams& shortcut(const Ogre::String& increment, const Ogre::String& decrement)
        {
            shortcutIncr_ = increment;
            shortcutDecr_ = decrement;
            return *this;
        }
        IntegerParams& readOnly(bool varReadOnly)
        {
            readOnly_ = varReadOnly;
            return *this;
        }
        IntegerParams& callback(TwSetVarCallback setter, TwGetVarCallback getter, void* varData)
        {
            setCB_ = setter;
            getCB_ = getter;
            data_ =varData;
            return *this;
        }
        IntegerParams& limits(int min, int max=INT_INFINITY, int step=INT_INFINITY)
        {
            min_ = min;
            max_ = max;
            step_ = step;
            return *this;
        }
        IntegerParams& value(const int& intVal)
        {
            value_ = intVal;
            return *this;
        }
    private:
		Window* parent_;
		Ogre::String name_;
        Ogre::String label_;
        Ogre::String group_;
        Ogre::String help_;
        Ogre::String shortcutIncr_;
        Ogre::String shortcutDecr_;
		TwType type_;
        bool readOnly_;
        void* data_;
        TwSetVarCallback setCB_;
        TwGetVarCallback getCB_;
        int min_;
        int max_;
        int step_;

        int value_;
        
        friend class Window;
		friend class IntegerVariable;		
    };
    
    class TwOgreExport IntegerVariable : public Variable
	{
	protected:
		IntegerVariable(Window *parent, const Ogre::String& name, bool readOnly, const Ogre::String& label, 
			int value, const Ogre::String& groupName, const Ogre::String& help);
		IntegerVariable(IntegerParams& params);
		~IntegerVariable();

	public:
		int getIntegerValue() const {return mValue;}
		void setIntegerValue(int value) {mValue = value;}

		void toHex();
		void toDecimal();

		void setLimits(int min, int max=INT_INFINITY, int step=INT_INFINITY);
		void setShortcut(const Ogre::String& increment, const Ogre::String& decrement);

	private:
		int mValue;

		friend class Window;
	};
}; // End Namespace
#endif
